#include <iostream>

int add(int a, int b)
{
	return a + b;
}

int sub(int a, int b)
{
	return a - b;
}

double ave(int a, int b)
{
	return add(a, b) / 2.0;
}

double dif(int a, int b)
{
	return sub(a, b) / 2.0;
}

int max(int a, int b, int c)
{
	if (a > b)
	{
		if (a > c)
		{
			return a;
		}
		else {
			return c;
		}
	}
	else if (b > c)
	{
		return b;
	}
	else {
		return c;
	}
}

int min(int a, int b, int c)
{
	if (a < b)
	{
		if (a < c)
		{
			return a;
		}
		else {
			return c;
		}
	}
	else if (b > c)
	{
		return c;
	}
	else {
		return b;
	}
}

int range(int a, int b, int c)
{
	return max(a, b, c) + min(a, b, c);
}

int main()
{
	int a = 1, b = 2, c = 3;
	std::cout << add(a, b) << std::endl;
	std::cout << sub(b, c) << std::endl;
	std::cout << ave(a, b) << std::endl;
	std::cout << dif(b, c) << std::endl;
	std::cout << max(a, b, c)-min(a,b,c)<< std::endl;
	std::cout << range(a, b, c) << std::endl;
}